import serial
from time import sleep

ser = serial.Serial(4)  # open first serial port
print ser.portstr       # check which port was really used
ser.setTimeout(0.2)
#ser.write("hello")      # write a string

def send(s):
    ser.write(s)
    sleep(0.2)
    while True:
        data = ser.read(64)
        if len(data) != 0:
            print data,
        else:
            print
            break

send('AT\r')
send('AT+CMGF=0\r')
send('AT+CSMS=0\r')

string = ''

send('AT+CMGS=24\r')
send('0011000A9154828856890000AA0CC8329BFD06DDDF72363904') 
send(chr(26)) # CTRL+Z            

#Success!
#send('AT+CMGS=24\r')
#send('0011000A9154828856890000AA0CC8329BFD06DDDF72363904') 
#http://rednaxela.net/pdu.php
